import Vue from 'vue';
import {{_type}}Tpl from './index.vue';

const EqxForm = require('@core/core/comp/form/form.js');

/**
 * 核心组件库 之 图片组件 EqxImage
 *
 * @extends EqxComp
 *
 */
class {{type}} extends EqxForm {
    constructor(compJson, eqxPage) {
        super(compJson, eqxPage);
        this.value = undefined;
        // 想上传表单数据就要加上这句话
        // this.eqxScene.formManager.add(this);
        this.vm = null;
    }

    create$li() {
        const $li = super.create$li();
        this.$wrapper = $li.find('.element-box-contents').get(0);
        this.renderComponent();
        return $li;
    }

    renderComponent() {
        Vue.observable(this.compJson);

        this.vm = new Vue({
            render: h => <{{_type}}Tpl compJson={this.compJson} />,
        });
        this.vm.$mount(this.$wrapper);
    }
}

export default {{type}};
